

<!DOCTYPE html>
<html>
<head>
	<link type="text/css" rel="stylesheet" href="http://base1.zhihuishu.com/able-commons/resources/cdn/letvuploader/0.1/fineuploader-4.1.0.css">
	<link type="text/css" rel="stylesheet" href="http://base1.zhihuishu.com/able-commons/resources/cdn/letvuploader/0.1/reset.css"/>
	<link type="text/css" rel="stylesheet" href="http://base1.zhihuishu.com/able-commons/resources/uploader/test/aspupload/css/aspupload/aspupload.css"/>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/uploader/client/js/jquery/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/cdn/ableuploader/0.2/jquery.fineuploader-4.1.0.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/cdn/ableuploader/0.2/ableuploader.js"></script>
    <script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/cdn/ableuploader/0.2/jquery-ui-1.9.1.custom.min.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/uploader/client/fineuploader.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/cdn/letvuploader/0.1/swfupload.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/uploader/client/swfupload/swfupload.queue.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/uploader/client/swfupload/swfupload.speed.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/cdn/ableuploader/0.2/handlers_01.js"></script>
	<script type="text/javascript" src="http://base1.zhihuishu.com/able-commons/resources/cdn/ableuploader/0.2/html5upload2.js"></script>
<style>
p {font-size:1.5em;}
</style>

<script type="text/javascript">
$(function() {
	$('#fine-uploader').Ableuploader(
		{
			appName : "ablecommons",//对应应用名称
			//modelName : "image",//可不写，按文件类型命名，视频为video、图片为image、其他文件为file
			userId : "42", //填写用户ID
			userName : "test",
			fileType : "image", //上传文件类型三类： image; video; file;
			smallImgSize : "100:100", //图片或者视频的三种裁图大小
			bigImgSize : "400:488",
			middleImgSize : "260:250",
			//image : {maxHeight: 300,maxWidth:300},
			autoConvert : "true", //true为自动转换，false或者不配置为不自动转换(上传里需要自带文档转换,Flex上传不需要自带转换.)
			vIsUploadLetv : "true", //是否将视频上传到乐视
			oldFileUrl : "", //myuni/image/674/ca24fb63-1c98-4865-a1b0-fa76fb909d07.jpg
			targetId : "fine-uploader", //为按钮目标标签ID
			buttonWidth : "120", //IE789下设置此按钮宽度生效
			buttonHeight : "100",
			showProgress : "true", //是否显示任务栏进度条
			multipleUpload : "false",
//			fileSizeLimit : "2097152",
			z_language : "1",
			buttonText : "上传",
			buttonClass : "btnStyle_ac greenBtnSty03_width120",    
			//buttonTextStyle: "{ font-size: 12; color: #FFFFFF; display:inline-block;width:50;height:32;text-align:center; font-family: 'Microsoft YaHei';  }", // 按钮文字样式定义
			buttonTextStyle : "{ font-size: 14; color: #FFFFFF; display:inline-block;width:120;height:35;text-align:center; font-family: 'Microsoft YaHei';  }", // 按钮文字样式定义
			allowSuffix : "",//自定义限制后缀
			videoConvert : "true",
			host :"http://base1.zhihuishu.com/able-commons/",
			callbacks : {
				onFileDialogStart : function(tid) {
					//alert(1);
				},
				onError : function(id, fileName, reason) {
					
				},
				onUpload : function(id, fileName) {
					//alert(1);
				},
				onComplete : function(id, fileName,
						responseJSON) {
					if (responseJSON != '') {
						var type = "txt|doc|xls|ppt|docx|xlsx|pptx|pdf";
						var ss = fileName.substring(fileName.lastIndexOf(".")+1);
						var data = responseJSON.data;
            			var fileType = data.comeFromType;
            			var tableHtml = ""; 
            			if(fileType == "image"){
		       				tableHtml += "<tr>";
		       				tableHtml += "<td width='250'>"+fileName+"</td>";
		       				tableHtml += "<td width='100' style='text-align: center;'><a href='"+data.filePath+"' target='_blank'>点击预览</a></td>";
		       				tableHtml += "</tr>";
            			}else if(fileType == "video"){
            				
            				var hostM = "http://base1.zhihuishu.com/able-commons/";
		       				tableHtml += "<tr>";
		       				tableHtml += "<td width='250'>"+fileName+"</td>";
		       				tableHtml += "<td width='100' style='text-align: center;'><a href='"+hostM+"/resources/cdn/ableplayer/2.0/demo.html?id="
							+ data.videoId
							+ "' target='_blank'>点击播放</a></td>";
		       				tableHtml += "</tr>";
            			}else if(type.indexOf(ss) != -1){
		       				tableHtml += "<tr>";
		       				tableHtml += "<td width='250'>"+fileName+"</td>";
		       				tableHtml += "<td width='100' style='text-align: center;'><a href='http://base1.zhihuishu.com/able-commons/resources/demos/ablefilebrowser/swfReader.jsp?id="+data.fileId+"' target='_blank'>点击预览</a></td>";
		       				tableHtml += "</tr>";
            			}else{
            				tableHtml += "<tr>";
		       				tableHtml += "<td width='250'>"+fileName+"</td>";
		       				tableHtml += "<td width='100' style='text-align: center;'><a href='"+data.filePath+"' target='_blank'>下载</a></td>";
		       				tableHtml += "</tr>";
            			}
            			$("#sinfo").append(tableHtml);
            			getVideoAll();
					}
				},
				onCancel : function(id,fileName){
					//alert(1);	
				},
				onDelete : function(id) {

				},
				onDeleteComplete : function(id, xhrOrXdr,
						isError) {
					
				}
			}
		});
	getVideoAll();
});
function baseyzReadCookie1 (name)
{
    var cookieValue = "";
    var search = name + "=";
    if (document.cookie.length > 0)
    {
        offset = document.cookie.indexOf (search);
        if (offset != -1)
        {
            offset += search.length;
            end = document.cookie.indexOf (";", offset);
            if (end == -1)
                end = document.cookie.length;
            cookieValue = unescape (document.cookie.substring (offset, end))
        }
    }
    return cookieValue;
}
function getVideoAll(){
	var htmlVideoList = "";
	var hostM = "http://base1.zhihuishu.com/able-commons/";
	var aa = '<tr><th width="16%">videoId</th><th width="16%">视频名称</th><th width="16%">播放时长</th><th width="16%">视频大小</th><th width="16%">视频状态</th><th width="16%">操作</th></tr>';
	$("#videoList").html(aa);
	$.ajax({
		type : "POST",
		dataType : "json",
		url : "/able-commons/upload?getVideoAll",
		data : "appname=ablecommons",
		async :false,
		success : function(data) {
			if(data == null){
				
			}else{
				$.each(data,function(i,item){
					var htmlTr = "<tr>";
					htmlTr += "<td width='16%'>"+item.id +"</td>";
					htmlTr += "<td width='16%'>"+item.name +"</td>";
					htmlTr += "<td width='16%'>"+ item.duration +"</td>";
					htmlTr += "<td width='16%'>"+item.size+"</td>";
					var status = "";
					if(item.letvVideoDto == null){
						
					}else{
						if(item.letvVideoDto.letvStatus == 10){
							status = "正常播放";
						}else if(item.letvVideoDto.letvStatus == 20){
							status = "转码失败";
						}else if(item.letvVideoDto.letvStatus == 30){
							status = "处理中。。";
						}else if(item.letvVideoDto.letvStatus == 40){
							status = "停用";
						}
					}
					
					htmlTr += "<td width='16%'>"+ status +"</td>";
					htmlTr += "<td width='16%'><a href="+hostM+"/resources/cdn/ableplayer/2.0/demo.html?id="
					+ item.id
					+ " target='_blank'>点击预览</a></td></tr>";
					htmlVideoList += htmlTr;
				});
			}
			
		}
	});
	$("#videoList").append(htmlVideoList);
}
</script>
</head>
<body>
	<center>
		<p style="font-size:20pt;">
			<b>文件上传</b>
		</p>
		<hr>
			<div id="fine-uploader"></div>
			<div id="fine-uploaderz"></div>
			<br/><span><font color="red">支持视频类型（.wmv.avi.dat.asf.rm.rmvb.ram.mpg.mpeg.3gp.mov.mp4.m4v.dvix.dv.mkv.flv.vob.qt.divx.cpk.fli.flc.mod）</font></span>
			<br/><span><font color="red">支持文档转换格式（txt|doc|xls|ppt|docx|xlsx|pptx|pdf）</font></span>
			<br/>
		<hr>
		<div style="float:left;">
			<p>文件列表：</p>
			<table id="sinfo" align="center" border="1">
				<tr>
					<th width="250">文件名</th>
					<th width="100" style="text-align: center;">操作</th>
				</tr>
			</table>  
		</div>
		<div style="float:right;width:50%;">
			<p>历史文件列表：</p>
			<table id="videoList" border="1" align="center" style="width:100%">
			</table>
		</div> 
	</center>
</body>	
</html>
